import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import play.Application;
import play.GlobalSettings;


public class Global extends GlobalSettings {

	private ApplicationContext ctx;

//	protected static Properties createProperties() {
//        Properties properties = new Properties();
//        properties.setProperty("mybatis.environment.id", "development");
//        properties.setProperty("JDBC.driver", "com.mysql.jdbc.Driver");
//        properties.setProperty("JDBC.url", "jdbc:mysql://localhost:3306/sampledb");
//        properties.setProperty("JDBC.username", "root");
//        properties.setProperty("JDBC.password", "123456");
//        return properties;
//    }
	
    @Override
    public void onStart(Application app) {
        ctx = new ClassPathXmlApplicationContext("application-context.xml");
    }

    @Override
    public <A> A getControllerInstance(Class<A> clazz) throws Exception{
        return ctx.getBean(clazz);
    }
}